package com.bkitmobile.kesu.appengine.storingdata.server.entity;

import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;


@PersistenceCapable
public class UserConfig {
        public static final int SILENT = 0;
        public static final int RING = 1;
        public static final int VIBRATE = 2;
        public static final int RING_AND_VIBRATE = 3;
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;
       
        @Persistent
        private String username;
       
        @Persistent
        private int alertChat;
       
        @Persistent
        private int alertPlace;
       
        @Persistent
        private List<String> listType;
       
        @Persistent
        private boolean loadAround;
       
        @Persistent
        private boolean loadFavorite;
       
        @Persistent
        private boolean loadMyPlace;
       
        @Persistent
        private double distance;
        //contructor default config
        public UserConfig(String username)
        {
                this.setKey(KeyFactory.createKey(getClass().getSimpleName(), username));
                this.setUsername(username);
                setAlertChat(SILENT);
                setAlertPlace(SILENT);
                setListType(new ArrayList<String>());
                setLoadAround(true);
                setLoadFavorite(false);
                setLoadMyPlace(true);
                this.setDistance(Place.DISTANCE_LOAD_MAP);
        }
        public void setKey(Key key) {
                this.key = key;
        }
        public Key getKey() {
                return key;
        }
        public void setUsername(String username) {
                this.username = username;
        }
        public String getUsername() {
                return username;
        }
        public void setAlertChat(int alertChat) {
                this.alertChat = alertChat;
        }
        public int getAlertChat() {
                return alertChat;
        }
        public void setAlertPlace(int alertPlace) {
                this.alertPlace = alertPlace;
        }
        public int getAlertPlace() {
                return alertPlace;
        }
        public void setListType(List<String> listType) {
                this.listType = listType;
        }
        public List<String> getListType() {
                return listType;
        }
        public void setLoadAround(boolean loadAround) {
                this.loadAround = loadAround;
        }
        public boolean isLoadAround() {
                return loadAround;
        }
        public void setLoadFavorite(boolean loadFavorite) {
                this.loadFavorite = loadFavorite;
        }
        public boolean isLoadFavorite() {
                return loadFavorite;
        }
        public void setLoadMyPlace(boolean loadMyPlace) {
                this.loadMyPlace = loadMyPlace;
        }
        public boolean isLoadMyPlace() {
                return loadMyPlace;
        }
        public void setDistance(double distance) {
                this.distance = distance;
        }
        public double getDistance() {
                return distance;
        }
}

